<template>
  <div class="influencers">
    <div class="banner flexc">
      <img src="@/assets/img/activity/influencers/cn.png"
        alt=""
        v-if="$store.state.app.language === 'zh-CN'">
      <img src="@/assets/img/activity/influencers/tw.png" alt="" v-else-if="$store.state.app.language === 'zh-TW'">
      <img src="@/assets/img/activity/influencers/en.png" alt="" v-else>
    </div>
    <div class="vedio">
      <span class="video-btn" @click="handlePlayVideo"></span>
      <a :href="videoUrl" class="hidden" target="_blank" ref="videoHref"></a>
    </div>
    <div class="influencers-list">
      <div class="influencers-title center">{{ $t('influencers.influencerList') }}</div>
      <div class="flex mb5">
        <div class="influencers-cont">
          <p>{{ $t('influencers.name1') }}</p>
          <p>{{ $t('influencers.nation1') }}</p>
          <p>{{ $t('influencers.decentralization1') }}</p>
          <span>W</span>
        </div>
        <!-- <div class="influencers-cont">
          <p>{{ $t('influencers.name2') }}</p>
          <p>{{ $t('influencers.nation2') }}</p>
          <p>{{ $t('influencers.decentralization2') }}</p>
          <span>J</span>
        </div> -->
        <div class="influencers-cont" >
          <p>{{ $t('influencers.name3') }}</p>
          <p>{{ $t('influencers.nation3') }}</p>
          <p>{{ $t('influencers.decentralization3') }}</p>
          <span>T</span>
        </div>
        <div class="influencers-cont" style="margin-right: 0;">
          <p>{{ $t('influencers.name4') }}</p>
          <p>{{ $t('influencers.nation4') }}</p>
          <p>{{ $t('influencers.decentralization4') }}</p>
          <span>D</span>
        </div>
      </div>
      <div class="flex mb5">
        <div class="influencers-cont" >
          <p>{{ $t('influencers.name6') }}</p>
          <p>{{ $t('influencers.nation6') }}</p>
          <p>{{ $t('influencers.decentralization6') }}</p>
          <span>R</span>
        </div>
        <div class="influencers-cont" >
          <p>{{ $t('influencers.name9') }}</p>
          <p>{{ $t('influencers.nation9') }}</p>
          <p>{{ $t('influencers.decentralization9') }}</p>
          <span>Y</span>
        </div>
        <div class="influencers-cont" style="margin-right: 0;">
          <p>{{ $t('influencers.name12') }}</p>
          <p>{{ $t('influencers.nation12') }}</p>
          <p>{{ $t('influencers.decentralization12') }}</p>
          <span>R</span>
        </div>
      </div>
      <div class="flex mb5">
        <div class="influencers-cont">
          <p>{{ $t('influencers.name14') }}</p>
          <p>{{ $t('influencers.nation14') }}</p>
          <p>{{ $t('influencers.decentralization14') }}</p>
          <span>H</span>
        </div>
        <div class="influencers-cont flexc" style="margin-right: 0; flex: 2;">
          <div style="font-size: 40px;">......</div>
        </div>
      </div>
      <div class="flex mb5">
        <!-- <div class="influencers-cont flexc" style="margin-right: 0;">
          <div style="font-size: 40px;">......</div>
        </div> -->
      </div>
    </div>
    <p class="center tip">{{ $t('influencers.tip1') }}</p>
    <!-- 视频播放组件 -->
    <my-video
    :video-config="videoConfig"
    @listenVideoLevel="handleVideoLevel"/>
  </div>
</template>
<script>
import MyVideo from '@/components/Video';

export default {
  name: 'influencers', // 大使活动二期
  data() {
    return {
      videoUrl: '',
      videoConfig: {
        open: false,
        en: 'https://www.youtube.com/embed/vWukx3mNKn4', // 国外访问视频地址
        zh: 'https://newdex.oss-cn-hangzhou.aliyuncs.com/ambassador.mp4' // 国内
      },
    }
  },
  components: {
    MyVideo,
  },
  props: {},
  watch: {},
  computed: {},
  created() {
    document.title = this.$t(`rout.${this.$route.meta.title}`);
  },
  mounted() {},
  beforeDestroy() {},
  methods: {
    // 视频播放
    handlePlayVideo() {
      const userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串
      this.videoUrl = this.videoConfig.en;
      const lang = this.$store.state.app.language;
      if (lang === 'zh-CN' || lang === 'zh-TW') {
        this.videoUrl = this.videoConfig.zh;
      }
      if (userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1) {
        setTimeout(() => {
          this.$refs.videoHref.click();
        }, 500)
        return;
      }
      this.videoConfig.open = true;
    },
    // 关闭视频通知
    handleVideoLevel(val) {
      if (val === 'close') {
        this.videoConfig.open = false;
      }
    },
  },
}
</script>
<style lang="scss" scoped>
.influencers {
  margin-bottom: -6px;
  background: #000;
  padding-bottom: 100px;

  .banner {
    width: 100%;
    height: 550px;
    background: url('../../../assets/img/activity/influencers/background.png') no-repeat;
    background-size: 100% 100%;
    img {
      display: block;
      height: 300px;
      margin-top: -100px;
    }
  }

  .vedio {
    width: 860px;
    height: 490px;
    margin: -50px auto 0;
    background: skyblue;
    background: url('../../../assets/img/activity/influencers/vedio.png');
    background-size: 100% 100%;
    position: relative;

    .video-btn {
      position: absolute;
      width: 50px;
      height: 50px;
      top: 50%;
      left: 50%;
      transform: translate3d(-50%, -50%, 0);
      background: url('../../../assets/img/videoplay.png');
      background-size: cover;
      cursor: pointer;
    }
  }

  .influencers-list {
    width: 1175px;
    margin: 100px auto 50px;

    .influencers-title {
      color: #FCCAA4;
      font-size: 36px;
      margin-bottom: 40px;
    }

    .influencers-cont {
      // flex: 1;
      height: 390px;
      width: 389px;
      padding: 90px 30px;
      color: #fff;
      background: rgba(255, 227, 204, .31);
      margin-right: 5px;
      position: relative;

      p:nth-child(1) {
        font-size: 18px;
        margin-bottom: 15px;
      }

      p:nth-child(2) {
        font-size: 16px;
        margin-bottom: 40px;
      }

      p:nth-child(3) {
        line-height: 30px;
      }

      span {
        position: absolute;
        right: 5px;
        bottom: -50px;
        font-size: 250px;
        color: rgba(255, 255, 255, .06);
      }
    }
  }

  .tip {
    width: 900px;
    margin: auto;
    color: #E2BEA3;
  }
}
</style>

